*****************************************************************************************************************************************************
* PROJECT: 		WEALTH LOSSES DUE TO CORONA PANDEMIC
* DATE: 		2020-November
* CONTENT: 		Table A9 - Effects of expected stock market recovery on own outlook and plans: Heterogeneity
* AUTHORS: 		Tobin Hanspal, Johannes Wohlfart, Anni Weber
*****************************************************************************************************************************************************

		clear all
		set scheme lean2
		global pm = char(177)
		set more off
		gl date = c(current_date)
		graph set window fontface "cmr10"		
		
* set cd as /Replication_files_HanspalWeberWohlfart2020/

*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~						
** Table A9
*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~	
	
use data/processed/data_1, clear 

* adjust variables
replace planned_morestocks=. if stockowner==0
replace planned_lessstocks=. if stockowner==0

foreach var of varlist expec_debthigher expec_morehrs expec_retirlater never_ownwealth never_owninc ///
realized_anychangestocks realized_morestocks realized_lessstocks planned_anychangestocks planned_morestocks planned_lessstocks {
	gen `var'_00=100* `var' 
}
* 

*~ constraint
gen h_constrained=(constrained>3)
gen h_retired = (retired==1)

*~ age 
gen h_age=(age>48)
tab hhnetinc_19 if hhnetinc19_NR==0

*~ net income 
gen h_netinc=(hhnetinc_19>4)
gen h_netinc_alt=(hhnetinc_19>3)
replace h_netinc=. if hhnetinc19_NR==1

*~ other financial wealth 
drop h_ofinwealth_lvl
sum ofinwealth_lvl, d
gen h_ofinwealth_lvl=(ofinwealth_lvl>0)

*~ net wealth 
sum netwealth_Jan20, d
gen h_netwealth=(netwealth_Jan20<r(p50))


*~ recovery duration own net income  
replace recov_owninc_duration=0 if recov_owninc_duration<0
sum recov_owninc_duration  , d
replace recov_owninc_duration=20 if never_owninc==1
gen h_recovinc=(recov_owninc_duration>0)
gen h_never_owninc = (never_owninc==1)

*~ recovery duration own net wealth 
sum recov_hhwealth_duration, d
replace recov_hhwealth_duration=20 if never_ownwealth==1
sum recov_hhwealth_duration, d
gen h_recovwealth=(recov_hhwealth_duration>=r(p50))


gen h_male = male
gen h_bach = atleast_bachelor 
gen h_empl_ft =  empl_ft


global controls ln_hhnetinc hhnetinc19_NR ///
	ln_ofinwealth_lvl ln_retirewealth_lvl ///
	ln_realestate_lvl realestJan20_NR ///
	ln_debt_lvl  debtJan20_NR ///
	stockinvestor riskshare_finwealth_Jan201 stockexperience ///
	i.agecat male married separated_divorced widowed ///	
	highschool some_college_associate_degree atleast_bachelor  ///
	z_decisionmaker mainearner_alone self_empl retired unempl empl_other z_constrained ///
	republican other_party NR_party  ///
	i.region ///
	i.svydate

loc experiments "recov_hhwealth_duration z_finprospect planned_morestocks_00 planned_lessstocks_00 del_spend20_perc_tr02 expec_debthigher_00 expec_morehrs_00 expec_retirlater_00"
loc experiments1 "recov_hhwealth_duration z_finprospect"
loc experiments2 "del_spend20_perc_tr02 expec_debthigher_00 expec_morehrs_00 expec_retirlater_00"

preserve

clear all
eststo clear
estimates drop _all

set obs 10
qui gen x = 1
qui gen y = 1

loc columns = 0

foreach choice in `experiments' {

    loc ++columns
    qui eststo col`columns': reg x y

}

restore

loc colnum = 1
loc colnames ""


foreach choice in `experiments1' {

ivreg2 `choice' recovery_duration $controls i.treatment, r, if treated!=1 & stockowner==1 & h_age==0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat2 = "`r(bstar)'": col`colnum'
estadd loc thisstat3 = "`r(sestar)'": col`colnum'

ivreg2 `choice' recovery_duration $controls i.treatment, r, if treated!=1 & stockowner==1 & h_age==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat5 = "`r(bstar)'": col`colnum'
estadd loc thisstat6 = "`r(sestar)'": col`colnum'

* line 7 empty, test in line 8, line 9 empty

ivreg2 `choice' recovery_duration $controls i.treatment, r, if treated!=1 & stockowner==1 & h_netinc==0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat10 = "`r(bstar)'": col`colnum'
estadd loc thisstat11 = "`r(sestar)'": col`colnum'

ivreg2 `choice' recovery_duration $controls i.treatment, r, if treated!=1 & stockowner==1 & h_netinc==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat13 = "`r(bstar)'": col`colnum'
estadd loc thisstat14 = "`r(sestar)'": col`colnum'

* line 15 empty, test in line 16, line 17 empty

ivreg2 `choice' recovery_duration $controls i.treatment, r, if treated!=1 & stockowner==1 & h_netwealth==0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat18 = "`r(bstar)'": col`colnum'
estadd loc thisstat19 = "`r(sestar)'": col`colnum'

ivreg2 `choice' recovery_duration $controls i.treatment, r, if treated!=1 & stockowner==1 & h_netwealth==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat21 = "`r(bstar)'": col`colnum'
estadd loc thisstat22 = "`r(sestar)'": col`colnum'

* line 23 empty, test in line 24, line 25 empty

ivreg2 `choice' recovery_duration $controls i.treatment, r, if treated!=1 & stockowner==1 & male==0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat26 = "`r(bstar)'": col`colnum'
estadd loc thisstat27 = "`r(sestar)'": col`colnum'

ivreg2 `choice' recovery_duration $controls i.treatment, r, if treated!=1 & stockowner==1 & male==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat29 = "`r(bstar)'": col`colnum'
estadd loc thisstat30 = "`r(sestar)'": col`colnum'

* line 31 empty, test in line 32, line 33 empty

ivreg2 `choice' recovery_duration $controls i.treatment, r, if treated!=1 & stockowner==1 & atleast_bachelor==0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat34 = "`r(bstar)'": col`colnum'
estadd loc thisstat35 = "`r(sestar)'": col`colnum'

ivreg2 `choice' recovery_duration $controls i.treatment, r, if treated!=1 & stockowner==1 & atleast_bachelor==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat37 = "`r(bstar)'": col`colnum'
estadd loc thisstat38 = "`r(sestar)'": col`colnum'

* line 39 empty, test in line 40, line 41 empty

estadd loc thisstat42 "Yes": col`colnum'

loc ++colnum
loc colnames "`colnames' `"`: var la `choice''"'"

}





ivreg2 planned_morestocks_00 recovery_duration $controls i.stocktrades_realized i.treatment, r, if treated!=1 & stockowner==1 & h_age==0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat2 = "`r(bstar)'": col`colnum'
estadd loc thisstat3 = "`r(sestar)'": col`colnum'

ivreg2 planned_morestocks_00 recovery_duration $controls i.stocktrades_realized i.treatment, r, if treated!=1 & stockowner==1 & h_age==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat5 = "`r(bstar)'": col`colnum'
estadd loc thisstat6 = "`r(sestar)'": col`colnum'

* line 7 empty, test in line 8, line 9 empty

ivreg2 planned_morestocks_00 recovery_duration $controls i.stocktrades_realized i.treatment, r, if treated!=1 & stockowner==1 & h_netinc==0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat10 = "`r(bstar)'": col`colnum'
estadd loc thisstat11 = "`r(sestar)'": col`colnum'

ivreg2 planned_morestocks_00 recovery_duration $controls i.stocktrades_realized i.treatment, r, if treated!=1 & stockowner==1 & h_netinc==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat13 = "`r(bstar)'": col`colnum'
estadd loc thisstat14 = "`r(sestar)'": col`colnum'

* line 15 empty, test in line 16, line 17 empty

ivreg2 planned_morestocks_00 recovery_duration $controls i.stocktrades_realized i.treatment, r, if treated!=1 & stockowner==1 & h_netwealth==0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat18 = "`r(bstar)'": col`colnum'
estadd loc thisstat19 = "`r(sestar)'": col`colnum'

ivreg2 planned_morestocks_00 recovery_duration $controls i.stocktrades_realized i.treatment, r, if treated!=1 & stockowner==1 & h_netwealth==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat21 = "`r(bstar)'": col`colnum'
estadd loc thisstat22 = "`r(sestar)'": col`colnum'

* line 23 empty, test in line 24, line 25 empty

ivreg2 planned_morestocks_00 recovery_duration $controls i.stocktrades_realized i.treatment, r, if treated!=1 & stockowner==1 & male==0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat26 = "`r(bstar)'": col`colnum'
estadd loc thisstat27 = "`r(sestar)'": col`colnum'

ivreg2 planned_morestocks_00 recovery_duration $controls i.stocktrades_realized i.treatment, r, if treated!=1 & stockowner==1 & male==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat29 = "`r(bstar)'": col`colnum'
estadd loc thisstat30 = "`r(sestar)'": col`colnum'

* line 31 empty, test in line 32, line 33 empty

ivreg2 planned_morestocks_00 recovery_duration $controls i.stocktrades_realized i.treatment, r, if treated!=1 & stockowner==1 & atleast_bachelor==0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat34 = "`r(bstar)'": col`colnum'
estadd loc thisstat35 = "`r(sestar)'": col`colnum'

ivreg2 planned_morestocks_00 recovery_duration $controls i.stocktrades_realized i.treatment, r, if treated!=1 & stockowner==1 & atleast_bachelor==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat37 = "`r(bstar)'": col`colnum'
estadd loc thisstat38 = "`r(sestar)'": col`colnum'

* line 39 empty, test in line 40, line 41 empty

estadd loc thisstat42 "Yes": col`colnum'

loc ++colnum
loc colnames "`colnames' `"`: var la `choice''"'"




ivreg2 planned_lessstocks_00 recovery_duration $controls i.stocktrades_realized i.treatment, r, if treated!=1 & stockowner==1 & h_age==0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat2 = "`r(bstar)'": col`colnum'
estadd loc thisstat3 = "`r(sestar)'": col`colnum'

ivreg2 planned_lessstocks_00 recovery_duration $controls i.stocktrades_realized i.treatment, r, if treated!=1 & stockowner==1 & h_age==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat5 = "`r(bstar)'": col`colnum'
estadd loc thisstat6 = "`r(sestar)'": col`colnum'

* line 7 empty, test in line 8, line 9 empty

ivreg2 planned_lessstocks_00 recovery_duration $controls i.stocktrades_realized i.treatment, r, if treated!=1 & stockowner==1 & h_netinc==0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat10 = "`r(bstar)'": col`colnum'
estadd loc thisstat11 = "`r(sestar)'": col`colnum'

ivreg2 planned_lessstocks_00 recovery_duration $controls i.stocktrades_realized i.treatment, r, if treated!=1 & stockowner==1 & h_netinc==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat13 = "`r(bstar)'": col`colnum'
estadd loc thisstat14 = "`r(sestar)'": col`colnum'

* line 15 empty, test in line 16, line 17 empty

ivreg2 planned_lessstocks_00 recovery_duration $controls i.stocktrades_realized i.treatment, r, if treated!=1 & stockowner==1 & h_netwealth==0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat18 = "`r(bstar)'": col`colnum'
estadd loc thisstat19 = "`r(sestar)'": col`colnum'

ivreg2 planned_lessstocks_00 recovery_duration $controls i.stocktrades_realized i.treatment, r, if treated!=1 & stockowner==1 & h_netwealth==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat21 = "`r(bstar)'": col`colnum'
estadd loc thisstat22 = "`r(sestar)'": col`colnum'

* line 23 empty, test in line 24, line 25 empty

ivreg2 planned_lessstocks_00 recovery_duration $controls i.stocktrades_realized i.treatment, r, if treated!=1 & stockowner==1 & male==0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat26 = "`r(bstar)'": col`colnum'
estadd loc thisstat27 = "`r(sestar)'": col`colnum'

ivreg2 planned_lessstocks_00 recovery_duration $controls i.stocktrades_realized i.treatment, r, if treated!=1 & stockowner==1 & male==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat29 = "`r(bstar)'": col`colnum'
estadd loc thisstat30 = "`r(sestar)'": col`colnum'

* line 31 empty, test in line 32, line 33 empty

ivreg2 planned_lessstocks_00 recovery_duration $controls i.stocktrades_realized i.treatment, r, if treated!=1 & stockowner==1 & atleast_bachelor==0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat34 = "`r(bstar)'": col`colnum'
estadd loc thisstat35 = "`r(sestar)'": col`colnum'

ivreg2 planned_lessstocks_00 recovery_duration $controls i.stocktrades_realized i.treatment, r, if treated!=1 & stockowner==1 & atleast_bachelor==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat37 = "`r(bstar)'": col`colnum'
estadd loc thisstat38 = "`r(sestar)'": col`colnum'

* line 39 empty, test in line 40, line 41 empty

estadd loc thisstat42 "Yes": col`colnum'

loc ++colnum
loc colnames "`colnames' `"`: var la `choice''"'"


foreach choice in `experiments2' {

ivreg2 `choice' recovery_duration $controls i.treatment, r, if treated!=1 & stockowner==1 & h_age==0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat2 = "`r(bstar)'": col`colnum'
estadd loc thisstat3 = "`r(sestar)'": col`colnum'

ivreg2 `choice' recovery_duration $controls i.treatment, r, if treated!=1 & stockowner==1 & h_age==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat5 = "`r(bstar)'": col`colnum'
estadd loc thisstat6 = "`r(sestar)'": col`colnum'

* line 7 empty, test in line 8, line 9 empty

ivreg2 `choice' recovery_duration $controls i.treatment, r, if treated!=1 & stockowner==1 & h_netinc==0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat10 = "`r(bstar)'": col`colnum'
estadd loc thisstat11 = "`r(sestar)'": col`colnum'

ivreg2 `choice' recovery_duration $controls i.treatment, r, if treated!=1 & stockowner==1 & h_netinc==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat13 = "`r(bstar)'": col`colnum'
estadd loc thisstat14 = "`r(sestar)'": col`colnum'

* line 15 empty, test in line 16, line 17 empty

ivreg2 `choice' recovery_duration $controls i.treatment, r, if treated!=1 & stockowner==1 & h_netwealth==0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat18 = "`r(bstar)'": col`colnum'
estadd loc thisstat19 = "`r(sestar)'": col`colnum'

ivreg2 `choice' recovery_duration $controls i.treatment, r, if treated!=1 & stockowner==1 & h_netwealth==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat21 = "`r(bstar)'": col`colnum'
estadd loc thisstat22 = "`r(sestar)'": col`colnum'

* line 23 empty, test in line 24, line 25 empty

ivreg2 `choice' recovery_duration $controls i.treatment, r, if treated!=1 & stockowner==1 & male==0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat26 = "`r(bstar)'": col`colnum'
estadd loc thisstat27 = "`r(sestar)'": col`colnum'

ivreg2 `choice' recovery_duration $controls i.treatment, r, if treated!=1 & stockowner==1 & male==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat29 = "`r(bstar)'": col`colnum'
estadd loc thisstat30 = "`r(sestar)'": col`colnum'

* line 31 empty, test in line 32, line 33 empty

ivreg2 `choice' recovery_duration $controls i.treatment, r, if treated!=1 & stockowner==1 & atleast_bachelor==0

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat34 = "`r(bstar)'": col`colnum'
estadd loc thisstat35 = "`r(sestar)'": col`colnum'

ivreg2 `choice' recovery_duration $controls i.treatment, r, if treated!=1 & stockowner==1 & atleast_bachelor==1

local N=e(N)
local r2=round(e(r2_a),.001)

sigstar recovery_duration , prec(3)
estadd loc thisstat37 = "`r(bstar)'": col`colnum'
estadd loc thisstat38 = "`r(sestar)'": col`colnum'

* line 39 empty, test in line 40, line 41 empty

estadd loc thisstat42 "Yes": col`colnum'

loc ++colnum
loc colnames "`colnames' `"`: var la `choice''"'"

}


*** Tests column 1:
eststo: reg recov_hhwealth_duration recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_age==0
eststo: reg recov_hhwealth_duration recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_age==1
qui suest est9 est10, r
test [est9_mean]recovery_duration = [est10_mean]recovery_duration
estadd loc thisstat8 = string(`r(p)', "%9.2f"): col1

eststo: reg recov_hhwealth_duration recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_netinc==0
eststo: reg recov_hhwealth_duration recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_netinc==1
qui suest est11 est12, r
test [est11_mean]recovery_duration = [est12_mean]recovery_duration
estadd loc thisstat16 = string(`r(p)', "%9.2f"): col1

eststo: reg recov_hhwealth_duration recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_netwealth==0
eststo: reg recov_hhwealth_duration recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_netwealth==1
qui suest est13 est14, r
test [est13_mean]recovery_duration = [est14_mean]recovery_duration
estadd loc thisstat24 = string(`r(p)', "%9.2f"): col1

eststo: reg recov_hhwealth_duration recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & male==0
eststo: reg recov_hhwealth_duration recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & male==1
qui suest est15 est16, r
test [est15_mean]recovery_duration = [est16_mean]recovery_duration
estadd loc thisstat32 = string(`r(p)', "%9.2f"): col1

eststo: reg recov_hhwealth_duration recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & atleast_bachelor==0
eststo: reg recov_hhwealth_duration recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & atleast_bachelor==1
qui suest est17 est18, r
test [est17_mean]recovery_duration = [est18_mean]recovery_duration
estadd loc thisstat40 = string(`r(p)', "%9.2f"): col1


*** Tests column 2:
eststo: reg z_finprospect recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_age==0
eststo: reg z_finprospect recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_age==1
qui suest est19 est20, r
test [est19_mean]recovery_duration = [est20_mean]recovery_duration
estadd loc thisstat8 = string(`r(p)', "%9.2f"): col2

eststo: reg z_finprospect recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_netinc==0
eststo: reg z_finprospect recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_netinc==1
qui suest est21 est22, r
test [est21_mean]recovery_duration = [est22_mean]recovery_duration
estadd loc thisstat16 = string(`r(p)', "%9.2f"): col2

eststo: reg z_finprospect recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_netwealth==0
eststo: reg z_finprospect recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_netwealth==1
qui suest est23 est24, r
test [est23_mean]recovery_duration = [est24_mean]recovery_duration
estadd loc thisstat24 = string(`r(p)', "%9.2f"): col2

eststo: reg z_finprospect recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & male==0
eststo: reg z_finprospect recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & male==1
qui suest est25 est26, r
test [est25_mean]recovery_duration = [est26_mean]recovery_duration
estadd loc thisstat32 = string(`r(p)', "%9.2f"): col2

eststo: reg z_finprospect recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & atleast_bachelor==0
eststo: reg z_finprospect recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & atleast_bachelor==1
qui suest est27 est28, r
test [est27_mean]recovery_duration = [est28_mean]recovery_duration
estadd loc thisstat40 = string(`r(p)', "%9.2f"): col2


*** Tests column 3:
eststo: reg planned_morestocks_00 recovery_duration i.stocktrades_realized $controls i.treatment if treated!=1 & stockowner==1 & h_age==0
eststo: reg planned_morestocks_00 recovery_duration i.stocktrades_realized $controls i.treatment if treated!=1 & stockowner==1 & h_age==1
qui suest est29 est30, r
test [est29_mean]recovery_duration = [est30_mean]recovery_duration
estadd loc thisstat8 = string(`r(p)', "%9.2f"): col3

eststo: reg planned_morestocks_00 recovery_duration i.stocktrades_realized $controls i.treatment if treated!=1 & stockowner==1 & h_netinc==0
eststo: reg planned_morestocks_00 recovery_duration i.stocktrades_realized $controls i.treatment if treated!=1 & stockowner==1 & h_netinc==1
qui suest est31 est32, r
test [est31_mean]recovery_duration = [est32_mean]recovery_duration
estadd loc thisstat16 = string(`r(p)', "%9.2f"): col3

eststo: reg planned_morestocks_00 recovery_duration i.stocktrades_realized $controls i.treatment if treated!=1 & stockowner==1 & h_netwealth==0
eststo: reg planned_morestocks_00 recovery_duration i.stocktrades_realized $controls i.treatment if treated!=1 & stockowner==1 & h_netwealth==1
qui suest est33 est34, r
test [est33_mean]recovery_duration = [est34_mean]recovery_duration
estadd loc thisstat24 = string(`r(p)', "%9.2f"): col3

eststo: reg planned_morestocks_00 recovery_duration i.stocktrades_realized $controls i.treatment if treated!=1 & stockowner==1 & male==0
eststo: reg planned_morestocks_00 recovery_duration i.stocktrades_realized $controls i.treatment if treated!=1 & stockowner==1 & male==1
qui suest est35 est36, r
test [est35_mean]recovery_duration = [est36_mean]recovery_duration
estadd loc thisstat32 = string(`r(p)', "%9.2f"): col3

eststo: reg planned_morestocks_00 recovery_duration i.stocktrades_realized $controls i.treatment if treated!=1 & stockowner==1 & atleast_bachelor==0
eststo: reg planned_morestocks_00 recovery_duration i.stocktrades_realized $controls i.treatment if treated!=1 & stockowner==1 & atleast_bachelor==1
qui suest est37 est38, r
test [est37_mean]recovery_duration = [est38_mean]recovery_duration
estadd loc thisstat40 = string(`r(p)', "%9.2f"): col3


*** Tests column 4:
eststo: reg planned_lessstocks_00 recovery_duration i.stocktrades_realized $controls i.treatment if treated!=1 & stockowner==1 & h_age==0
eststo: reg planned_lessstocks_00 recovery_duration i.stocktrades_realized $controls i.treatment if treated!=1 & stockowner==1 & h_age==1
qui suest est39 est40, r
test [est39_mean]recovery_duration = [est40_mean]recovery_duration
estadd loc thisstat8 = string(`r(p)', "%9.2f"): col4

eststo: reg planned_lessstocks_00 recovery_duration i.stocktrades_realized $controls i.treatment if treated!=1 & stockowner==1 & h_netinc==0
eststo: reg planned_lessstocks_00 recovery_duration i.stocktrades_realized $controls i.treatment if treated!=1 & stockowner==1 & h_netinc==1
qui suest est41 est42, r
test [est41_mean]recovery_duration = [est42_mean]recovery_duration
estadd loc thisstat16 = string(`r(p)', "%9.2f"): col4

eststo: reg planned_lessstocks_00 recovery_duration i.stocktrades_realized $controls i.treatment if treated!=1 & stockowner==1 & h_netwealth==0
eststo: reg planned_lessstocks_00 recovery_duration i.stocktrades_realized $controls i.treatment if treated!=1 & stockowner==1 & h_netwealth==1
qui suest est43 est44, r
test [est43_mean]recovery_duration = [est44_mean]recovery_duration
estadd loc thisstat24 = string(`r(p)', "%9.2f"): col4

eststo: reg planned_lessstocks_00 recovery_duration i.stocktrades_realized $controls i.treatment if treated!=1 & stockowner==1 & male==0
eststo: reg planned_lessstocks_00 recovery_duration i.stocktrades_realized $controls i.treatment if treated!=1 & stockowner==1 & male==1
qui suest est45 est46, r
test [est45_mean]recovery_duration = [est46_mean]recovery_duration
estadd loc thisstat32 = string(`r(p)', "%9.2f"): col4

eststo: reg planned_lessstocks_00 recovery_duration i.stocktrades_realized $controls i.treatment if treated!=1 & stockowner==1 & atleast_bachelor==0
eststo: reg planned_lessstocks_00 recovery_duration i.stocktrades_realized $controls i.treatment if treated!=1 & stockowner==1 & atleast_bachelor==1
qui suest est47 est48, r
test [est47_mean]recovery_duration = [est48_mean]recovery_duration
estadd loc thisstat40 = string(`r(p)', "%9.2f"): col4



*** Tests column 5:
eststo: reg del_spend20_perc_tr02 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_age==0
eststo: reg del_spend20_perc_tr02 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_age==1
qui suest est49 est50, r
test [est49_mean]recovery_duration = [est50_mean]recovery_duration
estadd loc thisstat8 = string(`r(p)', "%9.2f"): col5

eststo: reg del_spend20_perc_tr02 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_netinc==0
eststo: reg del_spend20_perc_tr02 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_netinc==1
qui suest est51 est52, r
test [est51_mean]recovery_duration = [est52_mean]recovery_duration
estadd loc thisstat16 = string(`r(p)', "%9.2f"): col5

eststo: reg del_spend20_perc_tr02 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_netwealth==0
eststo: reg del_spend20_perc_tr02 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_netwealth==1
qui suest est53 est54, r
test [est53_mean]recovery_duration = [est54_mean]recovery_duration
estadd loc thisstat24 = string(`r(p)', "%9.2f"): col5

eststo: reg del_spend20_perc_tr02 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & male==0
eststo: reg del_spend20_perc_tr02 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & male==1
qui suest est55 est56, r
test [est55_mean]recovery_duration = [est56_mean]recovery_duration
estadd loc thisstat32 = string(`r(p)', "%9.2f"): col5

eststo: reg del_spend20_perc_tr02 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & atleast_bachelor==0
eststo: reg del_spend20_perc_tr02 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & atleast_bachelor==1
qui suest est57 est58, r
test [est57_mean]recovery_duration = [est58_mean]recovery_duration
estadd loc thisstat40 = string(`r(p)', "%9.2f"): col5


*** Tests column 6:
eststo: reg expec_debthigher_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_age==0
eststo: reg expec_debthigher_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_age==1
qui suest est59 est60, r
test [est59_mean]recovery_duration = [est60_mean]recovery_duration
estadd loc thisstat8 = string(`r(p)', "%9.2f"): col6

eststo: reg expec_debthigher_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_netinc==0
eststo: reg expec_debthigher_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_netinc==1
qui suest est61 est62, r
test [est61_mean]recovery_duration = [est62_mean]recovery_duration
estadd loc thisstat16 = string(`r(p)', "%9.2f"): col6

eststo: reg expec_debthigher_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_netwealth==0
eststo: reg expec_debthigher_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_netwealth==1
qui suest est63 est64, r
test [est63_mean]recovery_duration = [est64_mean]recovery_duration
estadd loc thisstat24 = string(`r(p)', "%9.2f"): col6

eststo: reg expec_debthigher_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & male==0
eststo: reg expec_debthigher_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & male==1
qui suest est65 est66, r
test [est65_mean]recovery_duration = [est66_mean]recovery_duration
estadd loc thisstat32 = string(`r(p)', "%9.2f"): col6

eststo: reg expec_debthigher_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & atleast_bachelor==0
eststo: reg expec_debthigher_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & atleast_bachelor==1
qui suest est67 est68, r
test [est67_mean]recovery_duration = [est68_mean]recovery_duration
estadd loc thisstat40 = string(`r(p)', "%9.2f"): col6


*** Tests column 7:
eststo: reg expec_morehrs_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_age==0
eststo: reg expec_morehrs_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_age==1
qui suest est69 est70, r
test [est69_mean]recovery_duration = [est70_mean]recovery_duration
estadd loc thisstat8 = string(`r(p)', "%9.2f"): col7

eststo: reg expec_morehrs_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_netinc==0
eststo: reg expec_morehrs_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_netinc==1
qui suest est71 est72, r
test [est71_mean]recovery_duration = [est72_mean]recovery_duration
estadd loc thisstat16 = string(`r(p)', "%9.2f"): col7

eststo: reg expec_morehrs_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_netwealth==0
eststo: reg expec_morehrs_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_netwealth==1
qui suest est73 est74, r
test [est73_mean]recovery_duration = [est74_mean]recovery_duration
estadd loc thisstat24 = string(`r(p)', "%9.2f"): col7

eststo: reg expec_morehrs_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & male==0
eststo: reg expec_morehrs_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & male==1
qui suest est75 est76, r
test [est75_mean]recovery_duration = [est76_mean]recovery_duration
estadd loc thisstat32 = string(`r(p)', "%9.2f"): col7

eststo: reg expec_morehrs_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & atleast_bachelor==0
eststo: reg expec_morehrs_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & atleast_bachelor==1
qui suest est77 est78, r
test [est77_mean]recovery_duration = [est78_mean]recovery_duration
estadd loc thisstat40 = string(`r(p)', "%9.2f"): col7


*** Tests column 8:
eststo: reg expec_retirlater_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_age==0
eststo: reg expec_retirlater_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_age==1
qui suest est79 est80, r
test [est79_mean]recovery_duration = [est80_mean]recovery_duration
estadd loc thisstat8 = string(`r(p)', "%9.2f"): col8

eststo: reg expec_retirlater_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_netinc==0
eststo: reg expec_retirlater_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_netinc==1
qui suest est81 est82, r
test [est81_mean]recovery_duration = [est82_mean]recovery_duration
estadd loc thisstat16 = string(`r(p)', "%9.2f"): col8

eststo: reg expec_retirlater_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_netwealth==0
eststo: reg expec_retirlater_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & h_netwealth==1
qui suest est83 est84, r
test [est83_mean]recovery_duration = [est84_mean]recovery_duration
estadd loc thisstat24 = string(`r(p)', "%9.2f"): col8

eststo: reg expec_retirlater_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & male==0
eststo: reg expec_retirlater_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & male==1
qui suest est85 est86, r
test [est85_mean]recovery_duration = [est86_mean]recovery_duration
estadd loc thisstat32 = string(`r(p)', "%9.2f"): col8

eststo: reg expec_retirlater_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & atleast_bachelor==0
eststo: reg expec_retirlater_00 recovery_duration $controls i.treatment if treated!=1 & stockowner==1 & atleast_bachelor==1
qui suest est87 est88, r
test [est87_mean]recovery_duration = [est88_mean]recovery_duration
estadd loc thisstat40 = string(`r(p)', "%9.2f"): col8

* age, net inc, net wealth, gender, education


loc rowlabels " "{\bf Panel A: $\text{Age}\le\text{median}$}" "Expected stock recovery duration (years)" " " "{\bf Panel B: $\text{Age}>\text{median}$}" "Expected stock recovery duration (years)" " " " " "p-value (A=B)" "\hline {\bf Panel C: $\text{Net income}\le\text{median}$}" "Expected stock recovery duration (years)" " " "{\bf Panel D: $\text{Net income}>\text{median}$}" "Expected stock recovery duration (years)" " " " " "p-value (C=D)" "\hline {\bf Panel E: $\text{Net wealth} \le\text{median}$}" "Expected stock recovery duration (years)" " " "{\bf Panel F: $\text{Net wealth}>\text{median}$}" "Expected stock recovery duration (years)" " " " " "p-value (E=F)" "\hline {\bf Panel G: $\text{Female}$}" "Expected stock recovery duration (years)" " " "{\bf Panel H: $\text{Male}$}" "Expected stock recovery duration (years)" " " " " "p-value (G=H)" "\hline {\bf Panel I: $\text{Below Bachelor}$}" "Expected stock recovery duration (years)" " " "{\bf Panel J: $\text{At least Bachelor}$}" "Expected stock recovery duration (years)" " " " " "p-value (I=J)" " " "\hline Individual controls" " 


forval i = 1/42 {
    loc rowstats "`rowstats' thisstat`i'"
}

eststo drop est**

esttab * using "Tables/TableA9.tex", replace cells(none) booktabs nonotes nomtitles compress alignment(c) nogap noobs nobaselevels label stats(`rowstats', labels(`rowlabels')) ///
     mgroups("\shortstack{Wealth\\recovery\\duration}" "\shortstack{Household\\ financial \\ prospects}" "\shortstack{Plan incr. \\ stock \\ share}" "\shortstack{Plan decr. \\ stock \\ share}"  "\shortstack{Exp.\\spend.\\growth}" "\shortstack{Incr.\\ exp.\\ debt}" "\shortstack{Incr. exp. \\ desired \\ hours}" "\shortstack{Incr. exp.\\ retirement \\ age}" , pattern(1 1 1 1 1 1 1 1  ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))





